import unittest
import unittest
from common.header.Header import Headers
from common.login import Login
from common.request import Requests
from pytest_assume.plugin import assume
import pytest
@pytest.mark.api
class TestCase9:
    def test_add_01(self):
        login = Login()
        login.login("这是添加用户")
        header = Headers().headers()
        print(header)
        data =  {"userName": "张宏飞", "mobile": "13187177071", "password": "123456"}
        res = Requests(headers=header).post_request(url="/boss/user/info/add", data=data)
        print(res.text)
        print(res.url)
        print(res.cookies)
    def test_add_02(self):
        login = Login()
        login.login("这是添加支付产品")
        header = Headers().headers()
        print(header)
        data = {"productCode":"1101","productName":"无花果"}
        res = Requests(headers=header).post_request(url="/boss/pay/product/add", data=data)
        print(res.text)
        print(res.url)
        print(res.cookies)
    def test_add_03(self):
        login = Login()
        login.login("这是添加支付配置")
        header = Headers().headers()
        print(header)
        data = {"user.userNo":"81925145938066870273","user.userName":"张宏飞","product.productCode":"1101","product.productName":"无花果","fundIntoType":"PLAT_RECEIVES","riskDay":"1","isAutoSett":"NO","securityRating":"MD5","merchantServerIp":"","we_appId":"","we_partnerKey":"","we_merchantId":"","ali_partner":"","ali_key":"","ali_sellerId":"","ali_appid":"","ali_rsaPrivateKey":"","ali_rsaPublicKey":""}
        res = Requests(headers=header).post_request(url="/boss/pay/config/add", data=data)
        print(res.text)
        print(res.url)
        print(res.cookies)

    def test_add_04(self):
        login = Login()
        login.login("绑定出款银行卡")
        header = Headers().headers()
        print(header)
        data ={"userNo":"81925145938066870273","userName":"张宏飞","bankCode":"ICBC","bankAccountType":"PUBLIC_ACCOUNT","bankAccountName":"柏阳辉","bankAccountNo":"66666666666666","cardType":"","cardNo":"6666666666","mobileNo":"13057972962","street":"南大街北工商学院"}
        res = Requests(headers=header).post_request(url="/boss/pay/config/editBank", data=data)
        print(res.text)
        print(res.url)
        print(res.cookies)
    def test_select_05(self):
        login = Login()
        login.login("查询账户余额")
        header = Headers().headers()
        res = Requests(headers=header).get_request(url="/boss/sett/getSettAmount",params={"userNo":"1925145938066870273"})
        print(res.text)
        assume(res.status_code == 200)

    def test_add_06(self):
        login = Login()
        login.login("发起结算")
        header = Headers().headers()
        print(header)
        data ={"user.userNo":"81925145938066870273","settAmount":"0"}
        res = Requests(headers=header).post_request(url="/boss/sett/launchSett", data=data)
        print(res.text)
        print(res.url)
        print(res.cookies)


    def test_add_07(self):
        login = Login()
        login.login("审核")
        header = Headers().headers()
        print(header)
        data ={"settId":"017139c83e1f45f9b13a21fe350bd82c","settStatus":"CONFIRMED","remark":"很好"}
        res = Requests(headers=header).post_request(url="/boss/sett/remit", data=data)
        print(res.text)
        print(res.url)
        print(res.cookies)

    def test_add_08(self):
        login = Login()
        login.login("打款")
        header = Headers().headers()
        print(header)
        data = {"settId":"017139c83e1f45f9b13a21fe350bd82c","settStatus":"CONFIRMED","remark":"很好"}
        res = Requests(headers=header).post_request(url="/boss/sett/audit", data=data)
        print(res.text)
        print(res.url)
        print(res.cookies)


if __name__ == '__main__':
    unittest.main()
